<!--
 *
 * @author 凡墙<jihaoju@qq.com>
 * @date 2019/11/12
 * @description
 -->
<template>
  <section>
    <div class="bg-color-white pd10 mb10 font-common">
      <div class="text-left">
        <span>总注册：<label class="color-blue">{{statistics.user.register.all}}</label>人,</span>
        <span>今日注册：<label class="color-blue">{{statistics.user.register.today}}</label>人,</span>
        <span>昨日注册：<label class="color-blue">{{statistics.user.register.yesterday}}</label>人,</span>
        <span>今日登录：<label class="color-blue">{{statistics.user.login.today}}</label>人,</span>
        <span>昨日登录：<label class="color-blue">{{statistics.user.login.yesterday}}</label>人，</span>
      </div>

      <div class="text-left mt10">
        <span>平台总收入：<label class="color-blue">{{statistics.platform_account.all}}</label>元,</span>
        <span>昨日收入：<label class="color-blue">{{statistics.platform_account.yesterday}}</label>元</span>
      </div>
    </div>

    <van-grid square :column-num="3" style="padding-bottom: 80px;">
      <van-grid-item :to="{name: 'MemberLists'}">
        <van-row class="text-center pt10">
          <van-icon name="friends-o" size="60px"/>
        </van-row>
        <van-row class="text-center pt10 pb10">会员管理</van-row>
      </van-grid-item>

      <van-grid-item :to="{name: 'MemberAuthLists'}">
        <van-row class="text-center pt10">
          <i class="iconfont icon-credentials_icon" style="font-size: 60px;" />
        </van-row>
        <van-row class="text-center pt10 pb10">认证管理</van-row>
      </van-grid-item>

      <van-grid-item :to="{name: 'ActivityLists'}">
        <van-row class="text-center pt10">
          <i class="iconfont icon-nav_activity" style="font-size: 60px;" />
        </van-row>
        <van-row class="text-center pt10 pb10">线下活动</van-row>
      </van-grid-item>

      <van-grid-item :to="{name: 'CourseLists'}">
        <van-row class="text-center pt10">
          <i class="iconfont icon-xinrenkecheng" style="font-size: 60px;" />
        </van-row>
        <van-row class="text-center pt10 pb10">课程管理</van-row>
      </van-grid-item>

      <van-grid-item :to="{name: 'ServicePackageLists'}">
        <van-row class="text-center pt10">
          <i class="iconfont icon-fuwubao" style="font-size: 60px;" />
        </van-row>
        <van-row class="text-center pt10 pb10">服务套餐</van-row>
      </van-grid-item>

      <van-grid-item :to="{name: 'MarketingIndex'}">
        <van-row class="text-center pt10">
          <i class="iconfont icon-yingxiao" style="font-size: 60px;" />
        </van-row>
        <van-row class="text-center pt10 pb10">营销</van-row>
      </van-grid-item>

      <van-grid-item :to="{name: 'WithdrawLists'}">
        <van-row class="text-center pt10">
          <i class="iconfont icon-taojinbi" style="font-size: 60px;" />
        </van-row>
        <van-row class="text-center pt10 pb10">提现管理</van-row>
      </van-grid-item>

      <van-grid-item :to="{name: 'MatchmakerLists'}">
        <van-row class="text-center pt10">
          <i class="iconfont icon-hongniang-copy" style="font-size: 60px;" />
        </van-row>
        <van-row class="text-center pt10 pb10">红娘管理</van-row>
      </van-grid-item>

      <van-grid-item :to="{name: 'PlatformAccountBookLists'}">
        <van-row class="text-center pt10">
          <i class="iconfont icon-shouzhiliushui" style="font-size: 60px;" />
        </van-row>
        <van-row class="text-center pt10 pb10">平台收支</van-row>
      </van-grid-item>
    </van-grid>

    <Tabbar active="home"/>
  </section>
</template>
<script>
  import Tabbar from './componets/Tabbar';
  import {statisticsAllUri} from '../common/api';

  export default {
    components: {
      Tabbar: Tabbar
    },
    data() {
      return {
        statistics: {
          user: {
            register: {all: 0, today: 0, yesterday: 0},
            login: {today: 0, yesterday: 0}
          },
          platform_account: {
            all: 0.00,
            yesterday: 0.00
          }
        }
      }
    },
    methods: {
      getStatistics() {
        let self = this
        this.$http.get(statisticsAllUri).then(response => {
          let {code, msg, data} = response.body
          if (code != 0) {
            self.toast(msg);
          } else {
            self.statistics.user = data.user;
            self.statistics.platform_account = data.platform_account;
          }
        }, response => {
          // error callback
        })
      }
    },
    mounted: function () {
      this.getStatistics();
    }
  }
</script>
<style scoped>

</style>
